﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MdcService.Log
{
    public class TraceLogger:ILogging
    {
        
        public TraceLogger()
        {
            
        }

        public void Debug(object sender, string message, Exception t = null)
        {
            Trace.WriteLine($"{DateTime.Now.Millisecond}\t{sender}\t{message}\t{t?.Message}");
            Trace.Flush();
        }

        public void Info(object sender, string message, Exception t = null)
        {
            Trace.TraceInformation($"{DateTime.Now.Millisecond}\t{sender}\t{message}\t{t?.Message}");
            Trace.Flush();
        }

        public void Warn(object sender, string message, Exception t = null)
        {
            Trace.TraceWarning($"{DateTime.Now.Millisecond}\t{sender}\t{message}\t{t?.Message}");
            Trace.Flush();
        }

        public void Error(object sender, string message, Exception t = null)
        {
            Trace.TraceError($"{DateTime.Now.Millisecond}\t{sender}\t{message}\t{t?.Message}");
            Trace.Flush();
        }

        public void Fatal(object sender, string message, Exception t = null)
        {
            Trace.Fail($"{DateTime.Now.Millisecond}\t{sender}\t{message}\t{t?.Message}");
            Trace.Flush();
        }
    }
}
